/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2023-11-24 15:38:32
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2023-11-24 16:11:14
 * @FilePath: \WingsUpdater-main\inc\PackageResolver\IPackageResolver.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

#pragma once
#include <memory>
#include <string>
#include <vector>
#include "Result.h"

// macro
#define PACKAGE_RESOLVER_NUM                                                                                                                                                2
#define PACKAGE_RESOLVER_INDEX_UDP                                                                                                                                          0
#define PACKAGE_RESOLVER_INDEX_TCP                                                                                                                                          1


// class
class IPackageResolver 
{
public:
    static std::shared_ptr<IPackageResolver> instance(const int which = PACKAGE_RESOLVER_INDEX_UDP);
    virtual ~IPackageResolver() = default;
    virtual Result init() = 0;
    virtual Result resolve(std::string &aliasReceiver, std::vector<uint8_t> &dataReceiver) = 0;
    virtual Result respond(const bool success, const std::string &detail = "");
    const std::string &type()const;
protected:
    IPackageResolver() = default;
protected:
    std::string m_type;
};
